//
//  LFFaceTracker.h
//  track_api
//
//  Copyright © 2017-2018 LINKFACE Corporation. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#import "LFTrackerDef.h"
#import "LFFaceFeature.h"

@interface LFFaceTracker : NSObject

/**
 tracker init

 @param licensePath 授权文件路径
 @return  tracker
 */
- (instancetype)initWithLicensePath:(NSString *)licensePath;

//最小人脸占比 范围：[0.1, 0.66] 默认0.2
//人脸占屏比小于该值则不返回
@property (nonatomic, assign) CGFloat facePercentageInImage;

//最小人脸分数 范围：[0.85, 0.95] 默认0.9
//人脸分数小于该值则不返回
@property (nonatomic, assign) CGFloat faceScore;


/**
 tracking

 @param sampleBuffer 采集的 sampleBuffer 数据流
 @param format 数据流编码格式
 @param orientation 方向
 @param isMirror 是否镜像(前置摄像头为YES)
 @return 人脸特征, 符合与否看errorCode
 */
- (LFFaceFeature *)detectFace:(CMSampleBufferRef)sampleBuffer CVPixelFormat:(LFTrackerPixelFormat)format orientation:(LFTrackerFaceOrientation)orientation isMirror:(BOOL)isMirror;

/**
 tracking
 
 @param data 采集的数据(CMSampleBufferRef 或者 image 转成unit8_t型数组)
 {sampleBuffer : CVPixelBufferRef pixelBuffer = (CVPixelBufferRef)CMSampleBufferGetImageBuffer(sampleBuffer);
 CVPixelBufferLockBaseAddress(pixelBuffer, 0);
 uint8_t *data = (uint8_t *)CVPixelBufferGetBaseAddressOfPlane(pixelBuffer, 0);
 int iWidth  = (int)CVPixelBufferGetWidth(pixelBuffer);
 int iHeight = (int)CVPixelBufferGetHeight(pixelBuffer);}
 {图片 : CFDataRef pixelData = CGDataProviderCopyData(CGImageGetDataProvider(image.CGImage));
 uint8_t *data = CFDataGetBytePtr(pixelData);
 int iWidth  = image.size.width;
 int iHeight = image.size.height;}
 @param iWidth int
 @param iHeight int
 @param format 编码格式
 @param orientation 方向
 @param isMirror 是否镜像(前置摄像头为YES)
 @return 人脸特征, 符合与否看errorCode
 */
- (LFFaceFeature *)detectFace:(uint8_t *)data iWidth:(int)iWidth iHeight:(int)iHeight CVPixelFormat:(LFTrackerPixelFormat)format orientation:(LFTrackerFaceOrientation)orientation isMirror:(BOOL)isMirror;

@end
